package com.yanfan.data.controller.dashBoard;

import com.yanfan.common.core.controller.BaseController;
import com.yanfan.common.core.domain.AjaxResult;
import com.yanfan.iot.domain.vo.CommonVo;
import com.yanfan.iot.service.IFirmwareService;
import com.yanfan.iot.service.IVarTempService;
import com.yanfan.notify.service.INotifyChannelService;
import com.yanfan.notify.service.INotifyTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Api(tags = "设备运维仪表盘数据")
@RestController
@RequestMapping("/template")
public class FirmwareDashBoardController extends BaseController {
    @Autowired
    IFirmwareService firmwareService;
    @Autowired
    IVarTempService varTempService;
    @Autowired
    INotifyTemplateService notifyTemplateService;
    @Autowired
    INotifyChannelService notifyChannelService;

    @GetMapping("/firmwareInfo")
    @ApiOperation("查询产品固件信息")
    public AjaxResult firmwareInfo() {
        CommonVo commonVo = firmwareService.selectDashboardInfo();
        return success(commonVo);
    }

    @GetMapping("/varTempInfo")
    @ApiOperation("采集点模板信息")
    public AjaxResult varTempInfo() {
        CommonVo commonVo = varTempService.selectDashboardInfo();
        return success(commonVo);
    }

    @GetMapping("/notifyTemplateInfo")
    @ApiOperation("采集点模板信息")
    public AjaxResult notifyTemplateInfo() {
        Map<String, Long> resMap = notifyTemplateService.selectDashboardInfo();
        return success(resMap);
    }

    @GetMapping("/notifyChannelInfo")
    @ApiOperation("采集点模板信息")
    public AjaxResult notifyChannelInfo() {
        return success(notifyChannelService.selectDashboardInfo());
    }

}
